<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
require_once __DIR__ . "/../autoload.php";
$accessKey = getenv("QINIU_ACCESS_KEY");
$secretKey = getenv("QINIU_SECRET_KEY");
$bucket = getenv("QINIU_TEST_BUCKET");
$auth = new Qiniu\Auth($accessKey, $secretKey);
$expires = 3600;
$policy = NULL;
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";
$expires = 7200;
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";
$expires = 3600;
$keyToOverwrite = "qiniu.mp4";
$upToken = $auth->uploadToken($bucket, $keyToOverwrite, $expires, $policy, true);
echo $upToken . "\n";
$returnBody = "{\"key\":\"\$(key)\",\"hash\":\"\$(etag)\",\"fsize\":\$(fsize),\"bucket\":\"\$(bucket)\",\"name\":\"\$(x:name)\"}";
$policy = ["returnBody" => $returnBody];
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";
$policy = ["callbackUrl" => "http://api.example.com/qiniu/upload/callback", "callbackBody" => "{\"key\":\"\$(key)\",\"hash\":\"\$(etag)\",\"fsize\":\$(fsize),\"bucket\":\"\$(bucket)\",\"name\":\"\$(x:name)\"}", "callbackBodyType" => "application/json"];
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";
$policy = ["callbackUrl" => "http://api.example.com/qiniu/upload/callback", "callbackBody" => "key=\$(key)&hash=\$(etag)&bucket=\$(bucket)&fsize=\$(fsize)&name=\$(x:name)"];
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";
$saveMp4Entry = Qiniu\base64_urlSafeEncode($bucket . ":avthumb_test_target.mp4");
$saveJpgEntry = Qiniu\base64_urlSafeEncode($bucket . ":vframe_test_target.jpg");
$avthumbMp4Fop = "avthumb/mp4|saveas/" . $saveMp4Entry;
$vframeJpgFop = "vframe/jpg/offset/1|saveas/" . $saveJpgEntry;
$policy = ["persistentOps" => $avthumbMp4Fop . ";" . $vframeJpgFop, "persistentPipeline" => "video-pipe", "persistentNotifyUrl" => "http://api.example.com/qiniu/pfop/notify"];
$upToken = $auth->uploadToken($bucket, NULL, $expires, $policy, true);
echo $upToken . "\n";

?>